Xceed Toolkit Plus for WPF v5.0 Documentation
In This Topic
    Providing a GroupHeaderControl template
    In This Topic

    The following example demonstrates how to provide, through a style, a new GroupHeaderControl template.

    XAML
    Copy Code
    <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
      <Grid.Resources>
        <Style TargetType="{x:Type xcdg:GroupHeaderControl}">
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type xcdg:GroupHeaderControl}">
                <Border Background="Orange" BorderThickness="2">
                  <StackPanel Orientation="Horizontal">
                    <CheckBox IsChecked="{Binding RelativeSource={RelativeSource
                                          TemplatedParent}, Path=Group.IsExpanded}"/>
                    <ContentPresenter/>
                  </StackPanel>
                </Border>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
        <xcdg:DataGridCollectionViewSource x:Key="cvs_orders"
                                         Source="{Binding Source={x:Static Application.Current},
                                                          Path=Orders}">
          <xcdg:DataGridCollectionViewSource.GroupDescriptions>
            <xcdg:DataGridGroupDescription PropertyName="ShipCountry"/>
          </xcdg:DataGridCollectionViewSource.GroupDescriptions>
        </xcdg:DataGridCollectionViewSource>
      </Grid.Resources>
      <xcdg:DataGridControl x:Name="OrdersGrid"
                            ItemsSource="{Binding Source={StaticResource cvs_orders}}"/>
    </Grid>